home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWPart / FWPrInfo.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  5.5 KB  |  241 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWPrInfo.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWPRINFO_H
  11. #define FWPRINFO_H
  12.  
  13. // ----- Foundation Includes -----
  14.  
  15. #ifndef FWSTDDEF_H
  16. #include "FWStdDef.h"
  17. #endif
  18.  
  19. #ifndef FWEXCLIB_H
  20. #include "FWExcLib.h"
  21. #endif
  22.  
  23. // ----- OS Includes -----
  24.  
  25. #ifndef FWGXCFG_H
  26. #include "FWGXCfg.h"
  27. #endif
  28.  
  29. #ifndef FWRECT_H
  30. #include "FWRect.h"
  31. #endif
  32.  
  33. // ----- OpenDoc Includes -----
  34.  
  35. #ifndef FWODTYPS_H
  36. #include "FWODTyps.h"
  37. #endif
  38.  
  39. #ifndef SOM_ODTransform_xh
  40. #include <Trnsform.xh>
  41. #endif
  42.  
  43. // ----- Platform -----
  44.  
  45. #if defined(FW_BUILD_MAC) && !defined(__PRINTING__)
  46. #include <Printing.h>
  47. #endif
  48.  
  49. #if defined(FW_SUPPORT_GX) && !defined(__GXTYPES__)
  50. #include <GXTypes.h>
  51. #endif
  52.  
  53. #if defined(FW_SUPPORT_GX) && !defined(__GXPRINTING__)
  54. #include <GXPrinting.h>
  55. #endif
  56.  
  57. #if defined(FW_SUPPORT_GX) && !defined(__GXENVIRONMENT__)
  58. #include <GXEnvironment.h>
  59. #endif
  60.  
  61. //========================================================================================
  62. // Forward class definitions
  63. //========================================================================================
  64.  
  65. class FW_CString;
  66. class FW_CPrintHandler;
  67.  
  68. class ODSession;
  69. class ODStorageUnit;
  70. class ODFrame;
  71. class ODFacet;
  72. class ODCanvas;
  73.  
  74. //========================================================================================
  75. // class FW_CPrintEnvironment
  76. //========================================================================================
  77.  
  78. class FW_CPrintEnvironment
  79. {
  80. public:
  81.     FW_DECLARE_AUTO(FW_CPrintEnvironment)
  82.     
  83.                             FW_CPrintEnvironment();
  84.     virtual                 ~FW_CPrintEnvironment();
  85.     
  86. #ifdef FW_BUILD_MAC
  87.     void                    MacRestoreResFile();
  88. #endif
  89.  
  90.     // ------ Implementation
  91. private:
  92. #ifdef FW_BUILD_MAC
  93.     GrafPtr                    fOldPort;
  94.     short                    fMacResFile;
  95. #endif                
  96. };
  97.  
  98. //========================================================================================
  99. // class FW_CPrintInfo
  100. //========================================================================================
  101.  
  102. class FW_CPrintInfo
  103. {
  104. public:
  105.     FW_DECLARE_AUTO(FW_CPrintInfo)
  106.     
  107.                             FW_CPrintInfo(
  108.                                 Environment*            ev,
  109.                                 ODStorageUnit*             storageUnit,
  110.                                 FW_CPrintEnvironment*    printEnv);
  111.                                 // Attempts to initialize from the storage unit; if
  112.                                 // there is no print into there, uses default values
  113.  
  114.     virtual                    ~FW_CPrintInfo();
  115.     
  116.     // ----- Print info
  117.     void                    GetCopyCount(short& copyCount, FW_Boolean& collate) const;
  118.     void                    GetPages(long& firstPage, long& lastPage);
  119.     FW_CRect                GetPageBounds() const;
  120.     FW_CRect                GetPaperBounds() const;
  121.     FW_Boolean                GetPrinterResolution(long& hRes, long& vRes) const;
  122.  
  123.     FW_Boolean                SetPrinterResolution(long hRes, long vRes);
  124.  
  125.     void                    SaveToStorageUnit(Environment* ev, ODStorageUnit* storageUnit) const;
  126.  
  127. #ifdef FW_BUILD_WIN
  128.     LPPRINTDLG                WinGetPrintDlg();
  129.     void                    WinUpdatePageRect();
  130. #endif
  131. #ifdef FW_BUILD_MAC
  132.     THPrint                    MacGetTHPrint() const;
  133. #endif
  134. #ifdef FW_SUPPORT_GX
  135.     gxJob                    GetGXJob() const;
  136. #endif
  137.  
  138.     // ------ Implementation
  139. protected:
  140. #ifdef FW_BUILD_WIN
  141.     PRINTDLG                fWinPrintDlg;
  142.     RECT                    fWinPageBounds;
  143.  
  144.     void                    WinSetPrintDlgToDefaults();
  145. #endif
  146. #ifdef FW_BUILD_MAC
  147.     THPrint                    fMacPrintRec;
  148. #endif
  149. #ifdef FW_SUPPORT_GX
  150.     gxJob                    fGXJob;
  151.     static gxJob            LoadFromStorageUnitGX(
  152.                                 Environment* ev,
  153.                                 ODStorageUnit* storageUnit);
  154. #endif
  155. };
  156.  
  157. //========================================================================================
  158. // class FW_CPrintJob
  159. //========================================================================================
  160.  
  161. class FW_CPrintJob
  162. {
  163. public:
  164.     FW_DECLARE_AUTO(FW_CPrintJob)
  165.     
  166.                             FW_CPrintJob(
  167.                                 FW_CPrintInfo*            printInfo,
  168.                                 FW_CPrintHandler*        printHandler,
  169.                                 FW_CPrintEnvironment*    printEnv);
  170.     virtual                    ~FW_CPrintJob();
  171.  
  172.     virtual ODFacet*        OpenDocument(
  173.                                 Environment*        ev,
  174.                                 ODFrame*            frame,
  175.                                 long                numPages,
  176.                                 const FW_CString&    title);
  177.  
  178.     virtual void            CloseDocument(
  179.                                 Environment*        ev,
  180.                                 ODFacet*            facet);
  181.                                 
  182.     virtual void            CloseDocumentOnError(
  183.                                 Environment*        ev,
  184.                                 ODFacet*            facet);
  185.     
  186.     virtual void            OpenPage(long pageNumber);
  187.     virtual void            ClosePage();
  188.     virtual void            ClosePageOnError();
  189.  
  190.     virtual void            FinishPrinting();
  191.  
  192.     // ------ Implementation
  193. protected:
  194.     FW_CPrintInfo*            fPrintInfo;
  195.     FW_CPrintHandler*        fPrintHandler;
  196.     FW_CPrintEnvironment*    fPrintEnv;
  197.     
  198.     void                    PrivCreatePlatformPrintJob(long    numPages, const FW_CString&    title);
  199.     ODCanvas*                PrivCreatePrintCanvas(Environment* ev, ODFacet* facet);
  200.     
  201.     void                    PrivAbortPlatformPrintJob();
  202.  
  203. #ifdef FW_SUPPORT_GX
  204.     gxViewPort                fGXViewPort;
  205.     gxShapeSpoolUPP            fGXSpoolUPP;
  206.     WindowPtr                fMacCanvasWindow;
  207.     
  208. #endif
  209. #ifdef FW_BUILD_WIN
  210.     int                        fWinSaveDCIndex;
  211. #endif
  212. #ifdef FW_BUILD_MAC
  213.     TPrPort*                fMacPrPort;
  214. #endif
  215.  
  216.     void                    DoCloseDocument(
  217.                                 Environment*        ev,
  218.                                 ODFacet*            facet,
  219.                                 FW_Boolean            checkErrors);
  220.  
  221.     void                    DoClosePage(
  222.                                 FW_Boolean            checkErrors);
  223. };
  224.  
  225. //========================================================================================
  226. // class FW_XPrint
  227. //========================================================================================
  228.  
  229. struct FW_XPrint
  230. {
  231.     static void CheckPrintError(FW_PlatformError error);
  232. #ifdef FW_SUPPORT_GX
  233.     static void                CheckGXJobError(gxJob job);
  234. #endif
  235. #ifdef FW_BUILD_MAC
  236.     static void                MacCheckPrintError();
  237. #endif
  238. };
  239.  
  240. #endif // FWPRINFO_H
  241.